package com.example.chenfenweb.controller;

import com.example.chenfenweb.config.WebConfig;
import com.example.chenfenweb.entity.SysTemplateManager;
import com.example.chenfenweb.service.ISysTemplateManagerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.view.RedirectView;

import java.util.List;
import java.util.Objects;

/**
 * @Description: 模板管理
 * @Author: jeecg-boot
 * @Date:   2024-06-22
 * @Version: V1.0
 */
@RestController
@Slf4j
public class SysBaseController {

	@Autowired
	private ISysTemplateManagerService sysTemplateManagerService;

	@GetMapping("/")
	public RedirectView redirect() {
		SysTemplateManager  sysTemplateManager  =	sysTemplateManagerService.getTemplateByStatus("1");
		if(ObjectUtils.isEmpty(sysTemplateManager)){
			return new RedirectView("http://127.0.0.1:9999/com/index.html");
		}
		return new RedirectView("http://127.0.0.1:9999/"+sysTemplateManager.getTemplatePath()+"/index.html");
	}

 }
